package com.ihai.spring.boot.sample.gp;

import org.postgresql.PGConnection;
import org.postgresql.copy.PGCopyOutputStream;

import java.io.DataOutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

/**
 * @author Adolphus
 * @description TODO
 * @date 2021/11/9 9:20
 */
public class Application2 {
    public static void main(String[] args) throws Exception {
        Class.forName("org.postgresql.Driver");
        Connection conn = DriverManager.getConnection("jdbc:postgresql://192.168.137.122:5432/richsyncdb", "richsync", "richsync");
        conn.setAutoCommit(false);

        Statement statement = conn.createStatement();
//        statement.execute("ALTER TABLE public.t1 DROP CONSTRAINT \"PRIMARY\"");
        statement.execute("ALTER TABLE public.t1 ADD CONSTRAINT \"PRIMARY\" PRIMARY KEY (\"col1\",\"col2\",\"col3\")");
        conn.commit();
    }
}
